package com.foxzzz.array;


public class Solution456 {
    public boolean find132pattern(int[] nums) {

        if (nums.length > 3) {
            Integer low = nums[0];
            Integer high = nums[1];
            for (int i = 2; i < nums.length; i++) {
                if (low >= high) {
                    low = high;
                    high = nums[i];
                } else if (high <= nums[i]) {
                    high = nums[i];
                } else if (nums[i] > low) {
                    return true;
                }
            }

        }
        return false;
    }

    public static void main(String[] args) {
        System.out.println(new Solution456().find132pattern(new int[]{0, 2, -4, -2,-3}));

        System.out.println(new Solution456().find132pattern(new int[]{1, 0, 1, -4, -3}));
        System.out.println(new Solution456().find132pattern(new int[]{1, 2, 3, 4}));
        System.out.println(new Solution456().find132pattern(new int[]{3, 1, 4, 2}));
        System.out.println(new Solution456().find132pattern(new int[]{-1, 3, 2, 0}));
    }
}
